    <h1>Edit Member</h1>
    
    <div class = "page">
      
    </div>
    
    <div class = "clear"></div>
                        
    <form action="<?php echo base_url(); ?>admin/member/edit/process" method="post" accept-charset="utf-8" class="email" id="register_step2_form" enctype="multipart/form-data">
    <div id="personal_infomation">
	<h3>Personal Infomation</h3>
	<div id="dashboard_level">
	    <span for="username">Level : </span>
	    
	    <?php echo $user_info['level']; ?>
	    
	    <input type="hidden" name="group" value="2" />
	    <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_info['id']; ?>" />
	    <input type="hidden" name="company_id" value="<?php echo $company_info['id']; ?>" />
	</div>
	<div <?php echo $user_info['is_gold']; ?> class="is_gold">
	    <span for="username">Gold Start : </span>
	    <input type="text" name="gold_start" id="gold_start" class="input_text_search datepicker" value="<?php echo date('Y-m-d',$user_info['gold_start']); ?>" />
	</div>
	<div <?php echo $user_info['is_gold']; ?> class="is_gold">
	    <span for="username">Gold Finish : </span>
	    <input type="text" name="gold_finish" id="gold_finish" class="input_text_search datepicker" value="<?php echo date('Y-m-d',$user_info['gold_finish']); ?>" />
	</div>
	<div>
	    <span for="username">Firstname : </span>
	    <input type="text" name="firstname" id="firstname" class="input_text_search" value="<?php echo $user_info['firstname']; ?>" />
	</div>
	<div>
	    <span for="username">Lastname : </span>
	    <input type="text" name="lastname" id="lastname" class="input_text_search" value="<?php echo $user_info['lastname']; ?>" />
	</div>
	<div>
	    <span for="email">Email : </span>
	    <input type="text" name="email" value="<?php echo $user_info['email']; ?>" id="email" class="input_text_search" />
	</div>
	<div>
	    <span for="username">Username : </span>
	    <input type="text" name="username" id="username" class="input_text_search" value="<?php echo $user_info['username']; ?>" />
	</div>
	<div>
	    <span for="password">New Password : </span>
	    <input type="password" name="password" id="password" class="input_text_search" value="" />
	</div>
	<div>
	    <span for="conf_password">Comfirm Password : </span>
	    <input type="password" name="conf_password" id="conf_password" class="input_text_search" />
	</div>
	<div>
	    <span for="member_tel">Tel. : </span>
	    <input type="text" name="member_tel" id="member_tel" class="input_text_search" value="<?php echo $user_info['tel']; ?>" />
	</div>
    </div>			    
    
    <div id="company_infomation">
	<h3>Company Infomation</h3>
	<div>
	    <span for="company_name">Company Name : </span>
	    <input type="text" name="company_name" id="company_name" class="input_text_search" value="<?php echo $company_info['name']; ?>" />
	</div>
	<div>
	    <span for="company_agent">Agent : </span>
	    <input name="company_agent" value="0" type="radio" <?php echo $company_info['agent']==0?'checked="checked"':''; ?> /> No
	    <input name="company_agent" value="1" type="radio" <?php echo $company_info['agent']==1?'checked="checked"':''; ?> /> Yes
	</div>
	<div class="clear"></div>
	<div>
	    <span for="company_category">Category : </span>
	    <select name="company_category" id="company_category">
		<option value="0" selected="selected">Select Category</option>
		<?php
		    foreach ($category_option as $v) {
			echo "<option value='{$v['id']}' {$v['selected']}>{$v['name_th']}</option>";
		    }
		?>
	    </select>
	</div>
	<div id="sub_cat_select">
	    <span for="company_subcat">Subcategory : </span>
	    <select name="company_subcat" id="company_subcat">
		<?php
		    foreach ($sub_category_option as $v) {
			echo "<option value='{$v['id']}' {$v['selected']}>{$v['name_th']}</option>";
		    }
		?>
	    </select>
	</div>
	<div>
	    <span for="company_address">Address : </span>
	    <textarea name="company_address" cols="15" rows="3" id="company_address" class="mceNoEditor" ><?php echo $company_info['address']; ?></textarea>
	</div>
	<div>
	    <span for="company_district">District : </span>
	    <input type="text" name="company_district" id="company_district" class="input_text_search" value="<?php echo $company_info['district']; ?>" />
	</div>
	<div>
	    <span for="company_province">Province : </span>
	    <select name="company_province">
		<option value="0">Select Province</option>
	    <?php
		foreach ($province_option as $v) {
		    echo "<option value='{$v['PROVINCE_ID']}' {$v['selected']}>{$v['PROVINCE_NAME']}</option>";
		}
	    ?>
	    </select>
	</div>
	<div>
	    <span for="company_postcode">Postcode : </span>
	    <input type="text" name="company_postcode" id="company_postcode" class="input_text_search" value="<?php echo $company_info['postcode']; ?>" />
	</div>
	<div>
	    <span for="company_country">Country : </span>
	    <select name="company_country">
		<option value="66" selected="selected">Thailand</option>
	    </select>
	</div>
	<div>
	    <span for="company_website">Website : </span>
	    <input type="text" name="company_website" id="company_website" class="input_text_search" value="<?php echo $company_info['website']; ?>" />
	</div>
	<div>
	    <span for="company_email">Email : </span>
	    <input type="text" name="company_email" id="company_email" class="input_text_search" value="<?php echo $company_info['email']; ?>" />
	</div>
	<div>
	    <span for="company_tel">Tel. : </span>
	    <input type="text" name="company_tel" id="company_tel" class="input_text_search" value="<?php echo $company_info['tel']; ?>" />
	</div>
	<div>
	    <span for="company_fax">Fax : </span>
	    <input type="text" name="company_fax" id="company_fax" class="input_text_search" value="<?php echo $company_info['fax']; ?>" />
	</div>
	<div>
	    <span for="company_brand">Brand : </span>
	    <input type="text" name="company_brand" id="company_brand" class="input_text_search" value="<?php echo $company_info['brand']; ?>" />
	</div>
	<div>
	    <span for="img">Image : </span>
	    <input type="file" name="img" id="img"  /> <?php echo $this->lang->line('image_dimension'); ?>
	</div>
	<div>
	    <span>&nbsp;</span>
	    <img src="<?php echo site_url(),'assets/image/company/',$company_info['id'],'/',$company_info['img']; ?>" />
	    <input type="hidden" name="old_img" value="<?php echo $company_info['img']; ?>" />
	</div>
	<div>
	    <span for="logoimg">Logo : </span>
	    <input type="file" name="logoimg" id="logoimg"  /> <?php echo $this->lang->line('logo_dimension'); ?>
	</div>
	<div>
	    <span>&nbsp;</span>
	    <img src="<?php echo site_url(),'assets/image/company/',$company_info['id'],'/',$company_info['logo']; ?>" />
	    <input type="hidden" name="old_logo" value="<?php echo $company_info['logo']; ?>" />
	</div>	
	<div>
	    <span for="mysubmit">&nbsp;</span>
	    <input type="submit" name="mysubmit"  id="mysubmit" value="Update"  />
	</div>
	<div class = "field error_msg">
	    <label></label>
	    <?php echo $message; ?>
	</div>
    </div>
    </form>		    
</div>
		    
		    <script type="text/javascript" src="<?php echo js_asset_url('jquery.validate.min.js'); ?>"></script>
		    <script type="text/javascript">
			$(document).ready(function(){
			    $("#register_step2_form").validate({
				rules: {
				    username: {
					required: true,
					rangelength:[5,32],
					remote: {
					    url: "<?php echo site_url(); ?>admin/member/user_existed",
					    type: "post",
					    data: {
						username: function() {
						    return $("#username").val();
						},
						id: function() {
						    return $("#user_id").val();
						}
					    }
					}
				    },
				    firstname: "required",
				    lastname: "required",
				    email: {
					required: true,
					email: true,
					remote: {
					    url: "<?php echo site_url(); ?>admin/member/email_existed",
					    type: "post",
					    data: {
						email: function() {
						    return $("#email").val();
						},
						id: function() {
						    return $("#user_id").val();
						}
					    }
					}
				    },
				    conf_password: {
					    equalTo: "#password"
				    },
				    company_category: {
					    min: 1
				    },
				    company_province: {
					    min: 1
				    },
				    company_name: "required",
				    company_postcode: "required"
				},
				messages: {
				    username: {
					required: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter username</em>",
					rangelength: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter username, between 5 and 32 characters</em>",
					remote: "&nbsp;&nbsp;&nbsp;&nbsp;<em>This username is existed</em>"
				    },
				    firstname: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter your firstname</em>",
				    lastname: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter your lastname</em>",
				    email: {
					required: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter an email address</em>",
					email: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter a valid email address</em>",
					remote: "&nbsp;&nbsp;&nbsp;&nbsp;<em>This email is existed</em>"
				    },
				    conf_password: {
					    equalTo: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter the same password as above</em>"
				    },
				    company_category: {
					    min: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please select category</em>"
				    },
				    company_province: {
					    min: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please select province</em>"
				    },
				    company_name: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter company name</em>",
				    company_postcode: "&nbsp;&nbsp;&nbsp;&nbsp;<em>Please enter postcode</em>"
				}
			    });
			    
			    $('#mysubmit').click(function(){
				if($("#register_step2_form").valid()){
				   $("#register_step2_form").submit();
				}
			    });
			    
			    $('#company_category').live('change',function(){
				var parentID = ($(this).val());
				if(parentID==0){
				    $('#sub_cat_select').css('display','none');
				}else{
				    $.get('<?php echo site_url(); ?>home/getSubOption/'+parentID,'',function(data){
					$('#company_subcat').html(data);
					$('#sub_cat_select').css('display','block');
				    });
				}
			    });
			    
			    $('#role_id').live('change',function(){
				if($(this).val()==2){
				    $('.is_gold').css('display','block');
				}else{
				    $('.is_gold').css('display','none');
				}
			    });
			    
			    $('.datepicker').datepicker({
				dateFormat: 'yy-mm-dd',
				changeMonth: true,
				changeYear: true
			    });
			});
		    </script>
		    <?=css_asset('jquery.validate/validate.css')?>
		    <style>
			#personal_infomation, #company_infomation{
			    margin:0 0 50px 50px;
			}
			#personal_infomation div, #company_infomation div{
			    clear:left;
			    margin-bottom:5px;
			}
			#personal_infomation span, #company_infomation span{
			    float:left;
			    width:130px;
			    text-align:right;
			    padding-right:5px;
			}
			.input_text_search{
			    width:250px;
			}
			#company_address{
			    width:250px;
			    height:80px;
			}
		    </style>